<!DOCTYPE html>
<html lang="en">
<head>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="static/asserts/css/index.css">
    <!-- 引入组件库 -->

    <meta charset="UTF-8">
    <title>登陆</title>
</head>


<body>
<!--<el-form method="post" action="/halo/login" >-->
<el-form :model="ruleForm" >
        <div id="app">
            <el-input style="margin: 20px 0" v-model="ruleForm.userName" type="text"  placeholder="账号"></el-input>
            <el-input style="margin: 20px 0" v-model="ruleForm.passWord"  type="password" placeholder="密码"></el-input>
            <div style="margin: 20px 0">
                <el-button type="primary"  @click="onSubmit('ruleForm')" >登陆</el-button>
                <el-button type="primary"  @click="onRegister('ruleForm')" >注册</el-button>
            </div>
        </div>
</el-form>

<div>
    <p style="color: red">${msg!""}</p>
    <p style="color: red"> ${message!""}</p>
</div>
</body>

<script src="static/asserts/js/vue.js"></script>
<script src="static/asserts/js/vue.js"></script>
<script src="static/asserts/js/index.js"></script>
<script src="static/asserts/js/vue-resource.js"></script>

<script>
    var Main = {
        data() {
            return {
                ruleForm: {
                    userName: '',
                    passWord: ''
                },
            };
        },
        methods: {
            onSubmit(formName) {
                //打印日志
                console.log(this.ruleForm.passWord);
                console.log(this.ruleForm.userName);
                //post请求  发送到账号密码信息到login方法
                        this.$http.post('/halo/login', {
                            'userName': this.ruleForm.userName,
                            'passWord': this.ruleForm.passWord,
                        }, {
                            /*
                            * 启用该选项后，请求会以application/x-www-form-urlencoded作为MIME type，就像普通的HTML表单一样。form形式传给后台，而非json形式。
                            * */
                            emulateJSON: true
                        }).then(function(res) {
                            //设置
                            if(res.data.code == '0') {
                                this.$message({
                                    message: "操作成功",
                                    type: 'success'
                                });
                                setTimeout(function(){
                                    window.location.reload()
                                },1500)
                                window.location.href='/findAll'
                            } else {
                                this.$message({
                                    message: res.body.message,
                                    type: 'error'
                                })
                                return;
                            }
                        })
            },
            onRegister(ruleForm){
                window.location.href="/halo/goRegister"
            }
        }
    }
    var Ctor = Vue.extend(Main)
    new Ctor().$mount('#app')
</script>
<!--<script>
    function LoadPage(){
        $.ajax({
            url:'detailCourseEvaluate/queryByEvaluateID',
            async:false,
            type:'post',
            dataType:"json",
            success:function(data){
                $("#teacherName").val(data.teacherName);
                $("#teacherCompany").val(data.teacherCompany);
                $("#teacherJob").val(data.teacherJob);
                $("#goodAt").val("擅长领域："+data.goodAt);
                $("#telphone").val("联系方式："+data.telphone);
                $("#evaluateLevel").val("综合评价："+data.evaluateLevel);
                $("#jxymsxf").val("教学与描述相符值："+data.jxymsxf);
                $("#jsdjxtd").val("讲师的教学态度值："+data.jsdjxtd);
                $("#jsxysd").val("讲师的响应速度值："+data.jsxysd);

            },
            error:function(){

            }
        });
</script>-->
</html>